@extends('admin.layout')
@section('content')
<style>
    .search_input{
        float: left;
        width: 10%;
    }
    .search_input input,.search_input select{
        width: 80%;
        height: 34px;
        padding: 6px 12px;
        font-size: 14px;
        line-height: 1.42857143;
        color: #555;
        background-color: #fff;
        background-image: none;
        border: 1px solid #ccc;
        border-radius: 4px;
    }
    .search_input select{
        padding: 0px;
        width: 100%;
    }
</style>
<div class="panel panel-default">
    <div id="notice">
    </div>
    <div class="panel-heading" style="height: auto;">
        <ol class="breadcrumb">
            <li>话题管理</li>
            <li class="active">话题列表</li>
            @if($flag)
            <li>回收站</li>
            @endif
        </ol>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
            <table class="table table-hover">
                <caption>
                    <form role="form-control" action="@if(!$flag) /admin/topic @else /admin/topic/show @endif">
                        <span class="search_input" style="width: 20%;"><input type="text" name="title" value="{{$request->title}}" placeholder="话题标题"></span>
                        <span class="search_input" style="width: 20%;"><input type="text" name="author" value="{{$request->author}}" placeholder="作者ID"></span>
                        <span class="search_input">
                            <select name="column" id="">
                                <option value="">选择栏目</option>
                            @foreach($columns as $ck=>$cv)
                                <option value="{{$ck}}" @if($ck == $request->column) selected @endif >{{$cv}}</option>
                            @endforeach
                            </select>
                        </span>
                        <span class="search_input">
                            <select name="status" id="">
                                <option value="">话题状态</option>
                                <option value="1" @if($request->status == 1) selected @endif >未审核</option>
                                <option value="2" @if($request->status == 2) selected @endif >已审核</option>
                                <option value="3" @if($request->status == 3) selected @endif >已删除</option>
                            </select>
                        </span>
                        <span class="search_input">
                            <!-- 每页条数: -->
                            <select name="num" id="">
                                <option value="10" @if($request->num == 10) selected @endif >10</option>
                                <option value="20" @if($request->num == 20) selected @endif >20</option>
                                <option value="30" @if($request->num == 30) selected @endif >30</option>
                                <option value="50" @if($request->num == 50) selected @endif >50</option>
                            </select>
                        </span>
                        <span class="search_input"><button class="btn btn-sm btn-info">筛选</button></span>
                        <span class="search_input"><button type="reset" class="btn btn-sm">清空条件</button></span>
                    </form>
                </caption>
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>标题</th>
                        <th>作者ID</th>
                        <th>栏目</th>
                        <th>状态</th>
                        @if(!$flag)<th>操作</th>@endif
                    </tr>
                </thead>
                <style>
                    #pages ul{
                        margin: 0px;
                    }
                </style>
                <tbody>
                    @foreach($topics as $k=>$v)
                    <tr>
                        <td>{{$v['id']}}</td>
                        <td>{{$v['title']}}</td>
                        <td>{{$v['user_id']}}</td>
                        <td>{{$columns[$v['column_id']]}}</td>
                        <td>@if($v['status'] == 1) 未审核 @elseif($v['status'] == 2) 已审核 @else 已删除 @endif</td>
                        @if(!$flag)
                        <td>
                            @if($v['status'] == 1)
                            <a href="/admin/topic/edit-{{$v['id']}}.html" class="btn btn-primary btn-xs">审核</a>
                            @else
                            <a href="/admin/topic/del-{{$v['id']}}" class="btn btn-danger btn-xs">删除</a>
                            @endif
                        </td>
                        @endif
                    </tr>
                    @endforeach
                </tbody>
                    <tr>
                        <td colspan="11" id="pages" class="text-right">
                            {!! $topics->appends($request->all())->render() !!}
                        </td>
                    </tr>
            </table>
        </div>
    </div>
</div>
@endsection